﻿@{
    ViewData["Title"] = "Login";
}
@section Head {
    <script src="~/js/axios.min.js"></script>
    <script src="~/js/vue3.js"></script>
}
<div class="text-center" id="app">
    <h1 class="display-4">Welcome {{ message }}</h1>
    <button v-on:click="login(1)">测试登录1</button>&nbsp;&nbsp;&nbsp;&nbsp;
    <button v-on:click="login(2)">测试登录2</button>
</div>
<script>
    const { createApp, ref } = Vue
    const app = createApp({
        // data() {
        //     return {
        //         message: 'Hello Vue22!'
        //     }
        // },
        setup() {
            const message = ref('Hello Vue');
            const login = (type) => {
                console.log('按钮被点击了！');
                var url = type == 2 ? "/Home/CheckLogin2" : "/Home/CheckLogin";
                axios.get(url + "?no=no1&password=123456").then(function (res) {
                    message.value = res.data.name;
                    console.log(res.data);
                });
            };
            return {
                message,
                login,
            };
        }
    });
    app.mount('#app')
</script>